home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2002 January / january_2002.iso / Piposh Special / Piposh / FRITZ1.DXR / 00133_strata.ls < prev    next >
Encoding:
Text File  |  2004-12-06  |  3.4 KB  |  78 lines

  1. on strata2 f
  2.   global ppl
  3.   repeat with i = 1 to f
  4.     if ((the locV of sprite getAt(ppl, i) > the locV of sprite getAt(ppl, i + 1)) and (getAt(ppl, i) < getAt(ppl, i + 1))) or ((the locV of sprite getAt(ppl, i) < the locV of sprite getAt(ppl, i + 1)) and (getAt(ppl, i) > getAt(ppl, i + 1))) then
  5.       u = getAt(ppl, i)
  6.       setAt(ppl, i, getAt(ppl, i + 1))
  7.       setAt(ppl, i + 1, u)
  8.       s = sprite(getAt(ppl, i)).flipH
  9.       sprite(getAt(ppl, i)).flipH = sprite(getAt(ppl, i + 1)).flipH
  10.       sprite(getAt(ppl, i + 1)).flipH = s
  11.       x = the loc of sprite getAt(ppl, i)
  12.       set the loc of sprite getAt(ppl, i) to the loc of sprite getAt(ppl, i + 1)
  13.       set the loc of sprite getAt(ppl, i + 1) to x
  14.       x = the member of sprite getAt(ppl, i)
  15.       set the member of sprite getAt(ppl, i) to the member of sprite getAt(ppl, i + 1)
  16.       set the member of sprite getAt(ppl, i + 1) to x
  17.     end if
  18.     if ((i + 2) < 5) and (f > 2) then
  19.       if ((the locV of sprite getAt(ppl, i) > the locV of sprite getAt(ppl, i + 2)) and (getAt(ppl, i) < getAt(ppl, i + 2))) or ((the locV of sprite getAt(ppl, i) < the locV of sprite getAt(ppl, i + 2)) and (getAt(ppl, i) > getAt(ppl, i + 2))) then
  20.         u = getAt(ppl, i)
  21.         setAt(ppl, i, getAt(ppl, i + 2))
  22.         setAt(ppl, i + 2, u)
  23.         s = sprite(getAt(ppl, i)).flipH
  24.         sprite(getAt(ppl, i)).flipH = sprite(getAt(ppl, i + 2)).flipH
  25.         sprite(getAt(ppl, i + 2)).flipH = s
  26.         x = the loc of sprite getAt(ppl, i)
  27.         set the loc of sprite getAt(ppl, i) to the loc of sprite getAt(ppl, i + 2)
  28.         set the loc of sprite getAt(ppl, i + 2) to x
  29.         x = the member of sprite getAt(ppl, i)
  30.         set the member of sprite getAt(ppl, i) to the member of sprite getAt(ppl, i + 2)
  31.         set the member of sprite getAt(ppl, i + 2) to x
  32.       end if
  33.     end if
  34.     if ((i + 3) < 5) and (f > 2) then
  35.       if ((the locV of sprite getAt(ppl, i) > the locV of sprite getAt(ppl, i + 3)) and (getAt(ppl, i) < getAt(ppl, i + 3))) or ((the locV of sprite getAt(ppl, i) < the locV of sprite getAt(ppl, i + 3)) and (getAt(ppl, i) > getAt(ppl, i + 3))) then
  36.         u = getAt(ppl, i)
  37.         setAt(ppl, i, getAt(ppl, i + 3))
  38.         setAt(ppl, i + 3, u)
  39.         s = sprite(getAt(ppl, i)).flipH
  40.         sprite(getAt(ppl, i)).flipH = sprite(getAt(ppl, i + 3)).flipH
  41.         sprite(getAt(ppl, i + 3)).flipH = s
  42.         x = the loc of sprite getAt(ppl, i)
  43.         set the loc of sprite getAt(ppl, i) to the loc of sprite getAt(ppl, i + 3)
  44.         set the loc of sprite getAt(ppl, i + 3) to x
  45.         x = the member of sprite getAt(ppl, i)
  46.         set the member of sprite getAt(ppl, i) to the member of sprite getAt(ppl, i + 3)
  47.         set the member of sprite getAt(ppl, i + 3) to x
  48.       end if
  49.     end if
  50.   end repeat
  51. end
  52.  
  53. on strata3 f
  54.   global ppl
  55.   o = [:]
  56.   oflip = []
  57.   omember = []
  58.   oloc = []
  59.   repeat with i = 1 to f
  60.     addProp(o, the locV of sprite getAt(ppl, i), getAt(ppl, i))
  61.     addAt(oflip, i, sprite(getAt(ppl, i)).flipH)
  62.     addAt(omember, i, the member of sprite getAt(ppl, i))
  63.     addAt(oloc, i, the loc of sprite getAt(ppl, i))
  64.   end repeat
  65.   sort(o)
  66.   ppl2 = duplicate(ppl)
  67.   repeat with i = 1 to f
  68.     if getAt(ppl, i) <> getAt(o, i) then
  69.       x = findPos(ppl, getAt(o, i))
  70.       sprite(getAt(ppl, i)).flipH = getAt(oflip, x)
  71.       set the loc of sprite getAt(ppl, i) to getAt(oloc, x)
  72.       set the member of sprite getAt(ppl, i) to getAt(omember, x)
  73.       setAt(ppl2, i, getAt(o, i))
  74.     end if
  75.   end repeat
  76.   ppl = duplicate(ppl2)
  77. end
  78.